package com.rajaev.dtu.tractor.domain.repository.mysql;

import com.rajaev.dtu.tractor.domain.entity.BatteryInspectTaskPo;
import com.rajaev.dtu.tractor.infrastructure.base.vo.BatteryInspectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Created with IDEA
 * @author: tianjie
 * @Date:2019/4/11
 * @Time:11:39
 */
@Repository
@Mapper
public interface BatteryInspectDao {


    /**
     * 查询未完成的任务
     * @return
     */
    List<BatteryInspectTaskPo> selectNoComplete();

    List<BatteryInspectVo> selectAllTasks(@Param("userId") Integer userId);

    /**
     * 新增一条任务
     * @param batteryInspectTaskPo
     */
    void insert(BatteryInspectTaskPo batteryInspectTaskPo);


    /**
     * 修改
     * @param batteryInspectTaskPo
     */
    @Update({
            "update t_battery_inspect_task set average_score = #{averageScore},state = #{state.code} where id = #{taskId}"
    })
    void update(BatteryInspectTaskPo batteryInspectTaskPo);

}
